/**
 * 提取数组元素类型
 *
 * Example: type String = ArrayItem<string[]> // string
 */
export type ArrayItem<T extends readonly unknown[]> = T extends readonly (infer ElementType)[]
  ? ElementType
  : never;

/**
 * 提取返回 data 属性的类型
 *
 * Example: type Data = Response<{ data: any[] }> // any[]
 */
export type ResponseData<T extends any> = T extends { data: infer R } ? R : never;
